﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace RRD2.Controler
{
    class Scanner
    {
        private string codeBuffer = string.Empty;
        private DAL.Logger logger = new DAL.Logger();

        public void WriteBuffer(string readChar)
        {
            try
            {
                codeBuffer += readChar.ToString();
            }
            catch (Exception ex)
            {
                DAL.Logger.WriteException(ex);
            }
        }

        public string ReadBuffer(bool isClearBuffer)
        {
            string value = string.Empty;
            try
            {
                value = codeBuffer;
                if (isClearBuffer)
                    this.ClearBuffer();
            }
            catch (Exception ex)
            {
                DAL.Logger.WriteException(ex);
            }
            return value;
        }

        public void ClearBuffer()
        {
            codeBuffer = string.Empty;
        }
    }
}
